package hbt;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import bean.*;

public class HbtUtil {
	private static final SessionFactory sessionFactory;
	static {
		try {
			AnnotationConfiguration config = new AnnotationConfiguration();
			config.addAnnotatedClass(ClienteVO.class);
			config.addAnnotatedClass(CondicionDePagoVO.class);
			config.addAnnotatedClass(CotizacionVO.class);
			config.addAnnotatedClass(FacturaVO.class);
			config.addAnnotatedClass(HistorialGananciaVO.class);
			config.addAnnotatedClass(IdItemHistorialVO.class);
			config.addAnnotatedClass(IdRodamientoVO.class);
			config.addAnnotatedClass(ItemCotizacionVO.class);
			config.addAnnotatedClass(ItemFacturaVO.class);
			config.addAnnotatedClass(ItemHistorialVO.class);
			config.addAnnotatedClass(ItemListaPreciosVO.class);
			config.addAnnotatedClass(ItemOrdenCompraVO.class);
			config.addAnnotatedClass(ItemPedidoVO.class);
			config.addAnnotatedClass(ListaDePreciosVO.class);
			config.addAnnotatedClass(ListaDescuentosVO.class);
			config.addAnnotatedClass(ListaGeneralVO.class);
			config.addAnnotatedClass(ListaOfertasVO.class);
			config.addAnnotatedClass(OficinaDeVentaVO.class);
			config.addAnnotatedClass(OrdenCompraVO.class);
			config.addAnnotatedClass(PedidoVO.class);
			config.addAnnotatedClass(PoliticaBeneficioVO.class);
			config.addAnnotatedClass(PoliticaBeneficioPorCantidadVO.class);
			config.addAnnotatedClass(PoliticaBeneficioPorFormaDePagoVO.class);
			config.addAnnotatedClass(PoliticaBeneficioPorHistorialVO.class);
			config.addAnnotatedClass(PoliticaBeneficioPorMontoVO.class);
			config.addAnnotatedClass(PoliticaBeneficioPorStockVO.class);
			config.addAnnotatedClass(PoliticaStockVO.class);
			config.addAnnotatedClass(PoliticaStockIngresosPorPedidosVO.class);
			config.addAnnotatedClass(PoliticaStockIngresosPorVentasVO.class);
			config.addAnnotatedClass(PoliticaStockSalidasVO.class);
			config.addAnnotatedClass(ProveedorVO.class);
			config.addAnnotatedClass(RodamientoVO.class);
			config.addAnnotatedClass(StockVO.class);
			config.addAnnotatedClass(EstadoVO.class);
			sessionFactory = config.buildSessionFactory();
		} catch (Throwable ex) {
			System.err.println("Initial SessionFactory creation failed." + ex);
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
}
